/* ==========================================================
   AI Delivery - Methodology Timeline
   File: wwwroot/css/ai-delivery-timeline.css
   Used by: Views/Partials/blocklist/Components/aiDeliveryTimelineBlock.cshtml
   Fluid layout: same scaling as the other blocks (6.8vw gutter).
   ========================================================== */
.ai-tl {
  --tl-navy: #14256b;
  --tl-orange: #ff9a45;
  --tl-gutter: 6.8vw;
  --tl-node: clamp(30px, 2.65vw, 68px);
  --tl-ease: cubic-bezier(.65, 0, .35, 1);
  --tl-ease-out: cubic-bezier(.16, 1, .3, 1);

  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: clamp(600px, 52.9vw, 1400px);
  overflow: hidden;
  isolation: isolate;
  background: #0b1430;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  touch-action: pan-y;
}
.ai-tl *, .ai-tl *::before, .ai-tl *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- Backgrounds: smooth crossfade ---------- */
.ai-tl__media {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}
.ai-tl__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.8s cubic-bezier(.45, 0, .25, 1);
  will-change: opacity, transform;
}
/* the new image fades in on top of the old one... */
.ai-tl__bg.is-active {
  z-index: 2;
  opacity: 1;
  animation: aiTlDrift var(--tl-ken, 9s) linear forwards;   /* very gentle, slow drift */
}
/* ...while the old one stays fully visible underneath, so there is no dark flash */
.ai-tl__bg.is-prev {
  z-index: 1;
  opacity: 1;
  transform: scale(1);
  transition: none;
}
@keyframes aiTlDrift {
  from { transform: scale(1.04); }
  to   { transform: scale(1); }
}
.ai-tl__media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    linear-gradient(90deg, rgba(14, 28, 80, .78) 0%, rgba(14, 28, 80, .38) 34%, rgba(14, 28, 80, 0) 60%),
    linear-gradient(180deg, rgba(14, 28, 80, .55) 0%, rgba(14, 28, 80, 0) 34%),
    linear-gradient(0deg, rgba(5, 10, 30, .5) 0%, rgba(5, 10, 30, 0) 36%);
  pointer-events: none;
}

/* ---------- Heading ---------- */
.ai-tl__head {
  position: relative;
  z-index: 3;
  max-width: 64vw;
  padding: clamp(40px, 4.4vw, 114px) var(--tl-gutter) 0;
}
.ai-tl__eyebrow {
  margin-bottom: clamp(10px, 1vw, 26px);
  font-size: clamp(11px, .9vw, 23px);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.ai-tl__heading {
  margin-bottom: clamp(6px, .5vw, 14px);
  font-size: clamp(22px, 1.9vw, 50px);
  font-weight: 600;
  line-height: 1.3;
}
.ai-tl__intro {
  margin-bottom: clamp(12px, 1.2vw, 30px);
  font-family: "DM Sans", "Poppins", sans-serif;
  font-size: clamp(13px, .86vw, 22px);
  line-height: 1.6;
  color: rgba(255, 255, 255, .9);
}
.ai-tl__sub {
  font-size: clamp(16px, 1.32vw, 34px);
  font-weight: 600;
  line-height: 1.35;
}

/* ---------- Timeline ---------- */
.ai-tl__timeline {
  position: absolute;
  z-index: 4;
  top: 40.4%;
  left: var(--tl-gutter);
  right: var(--tl-gutter);
  height: var(--tl-node);
}
.ai-tl__track,
.ai-tl__fill {
  position: absolute;
  top: 50%;
  left: calc(var(--tl-node) / 2);
  height: 1px;
  transform: translateY(-50%);
}
.ai-tl__track {
  right: calc(var(--tl-node) / 2);
  background: rgba(255, 255, 255, .75);
}
.ai-tl__fill {
  height: 2px;
  width: 0;
  max-width: calc(100% - var(--tl-node));
  background: var(--tl-orange);
  box-shadow: 0 0 12px rgba(255, 154, 69, .8);
  transition: width 1.2s var(--tl-ease);
}
.ai-tl__nodes {
  position: relative;
  display: flex;
  justify-content: space-between;
  height: 100%;
  list-style: none;
}
.ai-tl__node {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--tl-node);
  height: var(--tl-node);
  border: 1.5px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  background: rgba(15, 25, 60, .35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  font-family: inherit;
  font-size: clamp(10px, .8vw, 21px);
  font-weight: 600;
  cursor: pointer;
  transition: background-color .5s var(--tl-ease), border-color .5s var(--tl-ease), transform .5s var(--tl-ease-out);
}
.ai-tl__node:hover { transform: scale(1.1); }
.ai-tl__node:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.ai-tl__node.is-done { border-color: var(--tl-orange); }
.ai-tl__node.is-active {
  background: var(--tl-orange);
  border-color: var(--tl-orange);
  transform: scale(1.06);
}
/* soft pulse on the active node */
.ai-tl__node.is-active::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1px solid rgba(255, 154, 69, .9);
  animation: aiTlPulse 2.4s var(--tl-ease-out) infinite;
}
@keyframes aiTlPulse {
  0%   { transform: scale(1);   opacity: .9; }
  100% { transform: scale(1.9); opacity: 0; }
}
/* countdown ring around the active node */
.ai-tl__ring {
  position: absolute;
  inset: -7px;
  width: calc(100% + 14px);
  height: calc(100% + 14px);
  transform: rotate(-90deg);
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
}
.ai-tl__ring circle {
  fill: none;
  stroke: #fff;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}
.ai-tl__node.is-active .ai-tl__ring { opacity: .95; }
.ai-tl.is-paused .ai-tl__node.is-active .ai-tl__ring { opacity: .45; }

/* ---------- Card deck ---------- */
.ai-tl__deck {
  position: absolute;
  z-index: 5;
  left: var(--tl-gutter);
  bottom: clamp(36px, 5.4vw, 140px);
  width: clamp(260px, 20.4vw, 540px);
  height: clamp(250px, 20vw, 520px);
}

element.style {
    --d: 1;
    z-index: 19;
}
.ai-tl__card {
    --d: 0;
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: clamp(18px, 1.75vw, 46px) clamp(18px, 1.75vw, 46px) clamp(20px, 1.9vw, 50px);
    background: linear-gradient(219deg, rgb(255 255 255 / 57%), rgba(170, 178, 200, .32));
    -webkit-backdrop-filter: blur(18px) saturate(1.1);
    backdrop-filter: blur(18px) saturate(1.1);
    border: 1px solid rgba(255, 255, 255, .28);
    transform-origin: 50% 50%;
    transform: translate3d(calc(var(--d) * .8vw), 0, 0) scaleY(calc(1 - var(--d) * .06));
    clip-path: inset(0 0 0 calc(100% - var(--d) * .8vw - 2px));
    opacity: calc(1 - var(--d) * .18);
    transition: transform 1s var(--tl-ease-out), opacity .8s ease, clip-path 1s var(--tl-ease-out);
}
/* the front card: full card, unfolds from its edge as it comes forward */
.ai-tl__card.is-front { clip-path: inset(0 0 0 0); }
/* the card that just left flies out to the left */
.ai-tl__card.is-gone {
  clip-path: inset(0 0 0 0);
  transform: translate3d(-5vw, 1.5vw, 0) rotate(-7deg) scale(.94);
  opacity: 0;
  transition: transform .9s var(--tl-ease), opacity .6s ease;
}
.ai-tl__card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.ai-tl__card-num {
  font-size: clamp(22px, 1.75vw, 46px);
  font-weight: 600;
  line-height: 1;
  color: var(--tl-orange);
}
.ai-tl__badge {
  padding: .45em .8em;
  background: var(--tl-navy);
  font-size: clamp(9px, .66vw, 17px);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ai-tl__card-body { margin-top: auto; }
.ai-tl__card-title {
  margin-bottom: clamp(10px, 1vw, 26px);
  font-size: clamp(18px, 1.42vw, 37px);
  font-weight: 600;
  line-height: 1.25;
}
.ai-tl__card-label {
  margin-bottom: clamp(6px, .55vw, 14px);
  font-size: clamp(11px, .82vw, 21px);
  font-weight: 600;
}
.ai-tl__card-text {
  max-width: 15em;
  font-family: "DM Sans", "Poppins", sans-serif;
  font-size: clamp(13px, .9vw, 23px);
  line-height: 1.6;
  color: rgba(255, 255, 255, .92);
}
/* only the front card shows its text; lines rise in one after another */
.ai-tl__card .ai-tl__rise {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .3s ease, transform .3s ease;
}
.ai-tl__card.is-front .ai-tl__rise {
  opacity: 1;
  transform: none;
  transition: opacity .6s ease var(--rd, .45s), transform .8s var(--tl-ease-out) var(--rd, .45s);
}

/* ---------- Prev / next ---------- */
.ai-tl__controls {
  position: absolute;
  z-index: 5;
  right: var(--tl-gutter);
  bottom: clamp(40px, 8.3vw, 210px);
  display: flex;
  gap: clamp(8px, .55vw, 14px);
}
.ai-tl__btn {
  display: grid;
  place-items: center;
  width: clamp(40px, 2.45vw, 64px);
  height: clamp(40px, 2.45vw, 64px);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: transform .4s var(--tl-ease-out), box-shadow .4s var(--tl-ease-out);
}
.ai-tl__btn svg { width: 40%; height: 40%; transition: transform .4s var(--tl-ease-out); }
.ai-tl__btn--prev { background: #fff; color: var(--tl-navy); }
.ai-tl__btn--next { background: var(--tl-orange); color: #fff; }
.ai-tl__btn:hover { transform: scale(1.08); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .6); }
.ai-tl__btn--prev:hover svg { transform: translateX(-2px); }
.ai-tl__btn--next:hover svg { transform: translateX(2px); }
.ai-tl__btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ---------- Entrance when scrolled into view ---------- */
.ai-tl.js-reveal .ai-tl__head > *,
.ai-tl.js-reveal .ai-tl__timeline,
.ai-tl.js-reveal .ai-tl__deck,
.ai-tl.js-reveal .ai-tl__controls { opacity: 0; transform: translateY(24px); }
.ai-tl.js-reveal.is-visible .ai-tl__head > *,
.ai-tl.js-reveal.is-visible .ai-tl__timeline,
.ai-tl.js-reveal.is-visible .ai-tl__deck,
.ai-tl.js-reveal.is-visible .ai-tl__controls {
  opacity: 1;
  transform: none;
  transition: opacity .9s ease, transform 1.1s var(--tl-ease-out);
}
.ai-tl.js-reveal.is-visible .ai-tl__head > :nth-child(2) { transition-delay: .08s; }
.ai-tl.js-reveal.is-visible .ai-tl__head > :nth-child(3) { transition-delay: .14s; }
.ai-tl.js-reveal.is-visible .ai-tl__head > :nth-child(4) { transition-delay: .2s; }
.ai-tl.js-reveal.is-visible .ai-tl__timeline { transition-delay: .28s; }
.ai-tl.js-reveal.is-visible .ai-tl__deck { transition-delay: .38s; }
.ai-tl.js-reveal.is-visible .ai-tl__controls { transition-delay: .46s; }

/* ---------- SMALL LAPTOP / TABLET ---------- */
@media (max-width: 1200px) {
  .ai-tl { --tl-gutter: 32px; }
  .ai-tl__head { max-width: 70vw; }
}

/* ---------- TABLET PORTRAIT & MOBILE: stacked flow ---------- */
@media (max-width: 900px) {
  .ai-tl { --tl-gutter: 24px; min-height: 0; display: flex; flex-direction: column; padding-bottom: 32px; }
  .ai-tl__media::after {
    background: linear-gradient(180deg, rgba(14, 28, 80, .82) 0%, rgba(14, 28, 80, .45) 45%, rgba(5, 10, 30, .75) 100%);
  }
  .ai-tl__head { max-width: none; }
  .ai-tl__timeline { position: relative; top: auto; left: auto; right: auto; margin: 32px var(--tl-gutter) 28px; }
  .ai-tl__deck { position: relative; left: auto; bottom: auto; width: auto; height: 270px; margin: 0 calc(var(--tl-gutter) + 30px) 0 var(--tl-gutter); }
  .ai-tl__controls { position: relative; right: auto; bottom: auto; justify-content: flex-end; margin: 20px var(--tl-gutter) 0; }
}

@media (max-width: 560px) {
  .ai-tl { --tl-gutter: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-tl *, .ai-tl *::before, .ai-tl *::after { transition-duration: .01ms !important; animation: none !important; }
}